import request from '@/router/axios'

import {
  appeal_status, appealType,
  fenExYuangettoFixed, getappeal_status,
  getAppealTypes, getIs_sup_payment,
  getLineName, getMappingStatus, getMappingStatusArray,
  getNoticeStates,
  getStationName, is_sup_payment,
  noticeStates
} from "../../../commonCheck";


export function getOption() {
  return {
    emptyBtn: false,
    editBtn: false,
    delBtn: false,
    addBtn: false,
    border: true,
    index: true,
    indexLabel: '序号',
    page: true,
    align: 'center',
    menuWidth: 150,
    menuAlign: 'center',
    selection: true,
    reserveSelection: false,
    column: [{label: "线路",width:100,  prop: "lineCode",search:true,searchslot:true,formatter: function(row, value , label, column){
        return getLineName(value);
      }},

      {label: "站点", width:180, prop: "stationCode",search:true,searchslot:true,formatter: function(row, value , label, column){
          return getStationName(row.lineCode,value);
        }},
      {label: "收入日期", prop: "incomeTime",
        width: 100,valueFormat:'yyyy-MM-dd',type:'date',search:true},

      {label: "车站人员", prop: "conductorPersonName",search:true},
      {label: "车站人员工号",width:120,  prop: "conductorJobNo"},
      {label: "营收总金额", width:120, prop: "cashReceiptsAmount",formatter:function (row,v) {
          return fenExYuangettoFixed(row,'cashReceiptsAmount');
        }},
      {label: "现金缴款单金额", width:140, prop: "cashPayAmount",formatter:function (row,v) {
          return fenExYuangettoFixed(row,'cashPayAmount');
        }},
      {label: "差异金额", prop: "diffAmount",formatter:function (row,v) {
          return fenExYuangettoFixed(row,'diffAmount');
        }},
      {label: "下发状态", prop: "sendState",type:'select',dicData:getMappingStatusArray('sw_st_invalidticket_status_qf')
        ,formatter: function(row, value , label, column){
          return getMappingStatus('sw_st_invalidticket_status_qf',value);
        }},
      {label: "下发时间", prop: "sendTime",type:'date',
        width: 160, format: 'yyyy-MM-dd HH:mm:ss',valueFormat:'yyyy-MM-dd HH:mm:ss'},
      {label: "回复期限（天）", prop: "replyPeriod"},
      /*
	  {label: "通知状态", prop: "noticeState",type:'select',search:true,dicData:
          [{value:'1',label:'已通知'},{value:'0',label:'未通知'}]
        ,formatter: function(row, value , label, column){
          let noticeStatus={'1':'已通知','0':'未通知'};
        return noticeStatus[value];
        }},*/

      {label: "申诉类型",width:120,  prop: "appealType",type:'select',dicData:appealType(),search:true,formatter:function (row,v) {
          return getAppealTypes(v);
        }},
      {label: "申诉状态", prop: "appealState",type:'select',search:true,dicData:getMappingStatusArray('car_appeal_status'),formatter:function (row,v) {
          return getMappingStatus('car_appeal_status',v);
        }},
      {label: "审批状态",width:120,  prop: "auditSate",type:'select',search:true,searchValue: '1',
        dicData:[{label:"待审批",value:"1"},{label:"审批通过",value:"2"},{label:"审批不通过",value:"3"}]
        ,formatter:function (row,v) {
          let state={'1':'待审批', '2':'审批通过','3':'审批不通过'};
          return state[v];
        }},

      {label: "补款状态",hide:true, prop: "suappStatus",type:'select',dicData:is_sup_payment(),formatter:function (row,v) {
          return getIs_sup_payment(v);
        }},
      {label: "补款日期",hide:true, prop: "suappTime",type:'date',
        width: 160,valueFormat:'yyyy-MM-dd'},
      {label: "申诉原因", prop: "appealReason"},
      {label: "备注", prop: "remark"},
      {label: "申诉回复", prop: "appealReply"},
      {label: "审批人", prop: "approverName"},
      {label: "审批时间",width:120,  type:'date', format:'yyyy-MM-dd',valueFormat:'yyyy-MM-dd', prop: "approverTime"},
      {label: "附件", prop: "fileUrl",hide:true}

    ]
  }
}



/**
 * 车站列表
 * @param query
 */
export function getSwAuStDiffNoticeList(query) {
  return request({
    url: '/check/check/getSwAuStDiffNoticeList',
    method: 'post',
    params: query
  })
}

/**
 * 设置回复期限
 * @param query
 */
export function setSwAuStDiffNoticeReplyPeriod(query) {
  return request({
    url: '/check/check/setSwAuStDiffNoticeReplyPeriod',
    method: 'post',
    params: query
  })
}

/**
 * 下发
 * @param query
 */
export function sendSwAuStDiffNoticeStatusUpdate(query) {
  return request({
    url: '/check/check/sendSwAuStDiffNoticeStatusUpdate',
    method: 'post',
    data: query
    //params: query
  })
}

/**
 * 支持批量审批
 * @param query
 */
export function approveDataSwAuStDiffNotice(query) {
  return request({
    url: '/check/check/approveDataSwAuStDiffNotice',
    method: 'post',
    params: query
  })
}

/**
 * 通知
 * @param query
 */
export function noticeSwAuStDiffNotice(query) {
  return request({
    url: '/check/check/noticeSwAuStDiffNotice',
    method: 'post',
    params: query
  })
}

//删除
export function delObj (query) {
  return request({
    url: '/check/check/removeStationByIds',
    method: 'get',
    params: query
  })
}
